<template>
    <div id='confirm_order'>
        <header1></header1>
            <h3 class="common_title">确认收货地址</h3>

            <div class="common_list_con clearfix">
                <dl>
                    <dt>寄送到：</dt>
                    <!-- <dd v-for='address in addresses' :class="[(nowsite==address.id)?'current':'']" @click="nowsite=address.id" :key="address.id">
                        <input type="radio" name="get_site" :value="address.id" v-model="nowsite">{{ address.province }} {{address.city}} {{ address.district }} {{ address.place }} （{{ address.receiver }} 收） {{ address.mobile }}</dd> -->
                    <dd>{{addresses}}</dd>
                </dl>
                <a href="user_center_site.html" class="edit_site">编辑收货地址</a>
            </div>
        
            <h3 class="common_title">支付方式</h3>
            <div class="common_list_con clearfix">
                <div class="pay_style_con clearfix">
                    <input type="radio" name="pay_style" value="4" v-model="pay_method">
                    <label class="cash">货到付款</label>
                    <input type="radio" name="pay_style" value="2" v-model="pay_method">
                    <label class="zhifubao"></label>
                </div>
            </div>
        
            <h3 class="common_title">商品列表</h3>
        
            <div class="common_list_con clearfix">
                <ul class="goods_list_th clearfix">
                    <li class="col01">商品名称</li>
                    <li class="col03">商品价格</li>
                    <li class="col04">数量</li>
                    <li class="col05">小计</li>
                </ul>
                <ul class="goods_list_td clearfix" v-for="(sku,index) in cartlist" :key="sku.id">
                    <li class="col01">{{index+1}}</li>
                    <li class="col02"><img :src="sku.image_url"></li>
                    <li class="col03">{{ sku.name }}</li>
                    <li class="col05">{{ sku.price }}元</li>
                    <li class="col06">{{ sku.number }}</li>
                    <li class="col07">{{ sku.number * sku.price }}元</li>
                </ul>
            </div>
        
            <h3 class="common_title">总金额结算</h3>
        
            <div class="common_list_con clearfix">
                <div class="settle_con">
                    <div class="total_goods_count">共<em>{{ count }}</em>件商品，总金额<b>{{ tmoney }}元</b></div>
                   
                    <div class="total_pay">实付款：<b>{{ tmoney }}元</b></div>
                </div>
            </div>
        
            <div class="order_submit clearfix">
                <a @click="on_order_submit" id="order_btn">提交订单</a>
            </div>
            <footer1></footer1>
            <!-- {{getCartlist}} -->
    </div>
</template>
<script>
import Header1 from '@/components/MD_shop/Header'
import Footer1 from '@/components/MD_shop/Footer'
import {send} from '../../../static/js/oss.js'
import { MD_bny_info,MD_buy_post} from '../axios_send/api.js'
export default{
  name:'order',
  components:{
    header1:Header1,
    footer1:Footer1
  },
  data:function(){
      return{
            tmoney:0,
            count:0,
            cartlist:[],
            pay_method:0,
            addresses:"北京市昌平区北小营"
      }
  },
  mounted() {
      this.getCartlist()
      
  },
  methods:{
    on_order_submit:function(){
        var data ={"all_money":this.all_money,"pay_method":this.pay_method,"addresses":this.addresses}
        MD_buy_post(data)
        .then(res=>{
            console.log(res);
        
        })
    },
    getCartlist(){
          MD_bny_info()
          .then(res=>{
              console.log(res)
              this.cartlist = res.data
              this.tmoney =res.all_money
              this.count =res.all_money
          })
      }
  }

}
</script>